{layout name="common/layout" /}
<style>
    .list-group{
        border: none;
    }
    .list-group-item{
        border: none;
    }
</style>
<section class="panel">
    <header class="panel-heading">
        商品分类
        <div class="btn-group  pull-right">
            <a class="btn btn-default " href="javascript:location.reload();"><span class="fa fa-refresh"></span></a>
            <a class="btn btn-default " href="{:WebUrl('admingoodsclass/add');}"><span class="fa fa-plus"></span> 添加分类</a>
        </div>
    </header>

    <div class="panel-body">

        <table class="table " id="mytable">
            <thead>
            <tr>
                <th>分类名</th>
                <th>排序</th>
                <th>佣金比例</th>
                <th>操作</th>
            </tr>
            </thead>
            <!--一级分类-->
            {php} if(!empty($goodsclass)){ {/php}
            {volist name="goodsclass" id="g_class"}
            <tr data-tt-id="{$g_class['gc_id']}">
                <td>|- {$g_class['gc_name']}</td>
                <td>{$g_class['gc_sort']}</td>
                <td>{$g_class['commis_rate']}</td>
                <td>
                    <div class="btn-group">
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            操作 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="{:WebUrl('admingoodsclass/add',array('id'=>$g_class['gc_id']))}"><i class="fa fa-plus"></i> 添加子类</a></li>
                            <li><a href="{:WebUrl('admingoodsclass/edit',array('id'=>$g_class['gc_id']))}"><i class="fa fa-pencil-square-o"></i> 分类编辑</a></li>
                            <li><a href="#"><i class="fa fa-trash-o"></i> 删除分类</a></li>
                        </ul>
                    </div>
                </td>
            </tr>
            <!--二级-->
            {volist name="g_class['child']" id="two"}
            <tr data-tt-id="{$two['gc_id']}" data-tt-parent-id="{$g_class['gc_id']}">
                <td>|-- {$two['gc_name']}</td>
                <td>{$two['gc_sort']}</td>
                <td>{$two['commis_rate']}</td>
                <td>
                    <div class="btn-group">
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            操作 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="{:WebUrl('admingoodsclass/add',array('id'=>$two['gc_id']))}"><i class="fa fa-plus"></i> 添加子类</a></li>
                            <li><a href="{:WebUrl('admingoodsclass/edit',array('id'=>$two['gc_id']))}"><i class="fa fa-pencil-square-o"></i> 分类编辑</a></li>
                            <li><a href="#"><i class="fa fa-trash-o"></i> 删除分类</a></li>
                        </ul>
                    </div>
                </td>
            </tr>
            <!--三级分类-->
            {volist name="two['child']" id="three"}
            <tr data-tt-id="{$three['gc_id']}" data-tt-parent-id="{$two['gc_id']}">
                <td>|--- {$three['gc_name']}</td>
                <td>{$three['gc_sort']}</td>
                <td>{$three['commis_rate']}</td>
                <td>
                    <div class="btn-group">
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            操作 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="{:WebUrl('admingoodsclass/edit',array('id'=>$three['gc_id']))}"><i class="fa fa-pencil-square-o"></i> 分类编辑</a></li>
                            <li><a href="#"><i class="fa fa-trash-o"></i> 删除分类</a></li>
                        </ul>
                    </div>
                </td>
            </tr>
            {/volist}
            <!--三级分类end-->
            {/volist}
            <!--二级end-->
            {/volist}
            <!--一级分类end-->
            {php} }{/php}
        </table>

    </div>

</section>

{js href="__PUBLIC__/admin/js/treetable/jquery.treetable.js"}
<script type="text/javascript">
    $(document).ready(function () {
        $("#mytable").treetable();
    });
</script>